The notification spec supports the concept of a 'default' action:
"The default action (usually invoked my clicking the notification)
should have a key named "default". The name can be anything, though
implementations are free not to display it."
Support this by invoking the 'default' action rather than a emitting
the 'clicked' signal when clicking notifications which specifie a
default action.
Also don't add an action button for the default action.
https://bugzilla.gnome.org/show_bug.cgi?id=655818
if (actions.length) {
notification.setUseActionIcons(hints['action-icons'] == true);
- for (let i = 0; i < actions.length - 1; i += 2)
- notification.addButton(actions[i], actions[i + 1]);
+ for (let i = 0; i < actions.length - 1; i += 2) {
+ if (actions[i] == 'default')
+ notification.connect('clicked', Lang.bind(this,
+ function() {
+ this._emitActionInvoked(id, "default");
+ });
+ else
+ notification.addButton(actions[i], actions[i + 1]);
+ }
}
switch (hints.urgency) {
case Urgency.LOW: